import instance from "@/utils/request";

//添加话题
export const addTopicService = (data) => {
  return instance({
    url: "/api/topic/addTopic",
    method: "post",
    headers: {
      "Content-Type": "application/json",
    },
    data,
  }).then((res) => res.data);
};
// 获取话题列表，用于展示  只有一个
export const getTopicListService = () => {
  return instance({
    url: "/api/topic/updateTopic",
    method: "get",
  }).then((res) => res.data);
};

// 获取话题的前10排行榜
export const getTopicRankService = () => {
  return instance({
    url: "/api/topic/ranking/getRanking",
    method: "get",
  }).then((res) => res.data);
};
// 搜索话题
export const searchTopics = (topicName) => {
  return instance({
    url: "api/topic/queryByTopic",
    method: "get",
    params: { topicName },
  });
};
